import prettytable as pt


def show_tickets(num):
    tb = pt.PrettyTable()
    # 设置标题
    tb.field_names = ['行号', '座位1', '座位2', '座位3', '座位4', '座位5']

    for i in range(1, num + 1):
        row = [f'第{i}排', '有票', '有票', '有票', '有票', '有票']
        # 添加到表格
        tb.add_row(row)


def order_ticket(num, position):
    tb = pt.PrettyTable()
    # 设置标题
    tb.field_names = ['行号', '座位1', '座位2', '座位3', '座位4', '座位5']

    for i in range(1, num + 1):
        row = [f'第{i}排', '有票', '有票', '有票', '有票', '有票']
        if int(position['row']) == i:
            row[position['column']] = '售罄'
        tb.add_row(row)
    print(tb)


if __name__ == '__main__':
    row_num = 6
    # 显示票务
    show_tickets(row_num)
    # 选择位置
    pos = {'row': 4, 'column': 3}
    order_ticket(row_num, pos)